<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css " rel="stylesheet" />
		<style>
			html,
			body {
				width: 100%;
				height: 100%;
			}
			
			.mui-bar-backdrop {
				width: 100%;
				top: 80%;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="width: 100%;margin: 0px;padding: 0px;height: 30%;">
			<!--<div id="slider" class="mui-slider" style="margin: 0px;padding: 0px;height: 80%;">
				<div id="b_cell" class="mui-slider-group mui-slider-loop" style="height: 100%;">
					<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;display: block;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;"> \ </a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
				</div>
				<div id="i_cell" class="mui-slider-indicator mui-text-center">
					<!--<div class="mui-indicator mui-active"></div>
					<div class="mui-indicator"></div>-->
			<!--</div>

			</div>-->
			<div id="slider" class="mui-slider" style="margin: 0px;padding: 0px;height: 80%;">
				<div class="mui-slider-group mui-slider-loop" style="height: 100%;">
					<!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
					<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
					<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;">
						<a href="#" style="height: 100%;width: 100%;">
							<img src="../image/lunbotu.png" style="height: 100%;width: 100%;">
						</a>
					</div>
				</div>
			</div>

			<div style="font-size: 85%;background-color: #4CD964;">
				<a id="title_fujin" href="#popover_fujin" style="width: 25%;float: left;text-align: center;padding: 0px;margin: 0px;height: 80%;margin-top: 1.5%;">
					附近<span class="mui-icon mui-icon-arrowdown" style="font-size: 100%;padding: 0px;margin: 0px;"></span>
				</a>
				<a href="#popover_zaiti" style="width: 25%;float: left;text-align: center;padding: 0px;margin: 0px;height: 80%;margin-top: 1.5%;">
					创业载体
					<span class="mui-icon mui-icon-arrowdown" style="font-size: 100%;padding: 0px;margin: 0px;"></span>
				</a>
				<a href="#popover_zhineng" style="width: 25%;float: left;text-align: center;padding: 0px;margin: 0px;height: 80%;margin-top: 1.5%;">
					智能排序
					<span class="mui-icon mui-icon-arrowdown" style="font-size: 100%;padding: 0px;margin: 0px;"></span>
				</a>
				<a href="#popover_shaixuan" style="width: 25%;float: left;text-align: center;padding: 0px;margin: 0px;height: 80%;margin-top: 1.5%;">
					筛选
					<span class="mui-icon mui-icon-arrowdown" style="font-size: 100%;padding: 0px;margin: 0px;"></span>
				</a>
			</div>
			<div id="popover_fujin" class="mui-popover mui-bar-popover" style="width: 100%;position:static;margin-top: 12%;">
				<ul id="table_view_diqu" class="mui-table-view mui-grid-view mui-grid-9" style="width: 100%;">
					<li id="40288b365665f01d015665f01d620000" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">徐汇区</div>
					</li>
					<li id="ff808081563666d401563694c0d40007" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">长宁区</div>
					</li>
					<li id="ff808081563666d401563694fd3f0009" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">静安区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668bf63200005" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">黄浦区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668bfdda80007" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">崇明区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668beb6710002" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">普陀区</div>
						</a>
					</li>
					<li id="8a21459c56b0e1820156b0e8449c0003" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">虹口区</div>
						</a>
					</li>
					<li id="c0092b8956fe77d80156febd68b30002" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">杨浦区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668c033800008" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">宝山区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668befbf00003" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">闵行区</div>
						</a>
					</li>
					<li id="c0092b8956fe77d80156febd93880003" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">嘉定区</div>
						</a>
					</li>
					<li id="c0092b8956fe77d80156febdda470004" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">浦东新区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668be4c6d0000" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">松江区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668bf2fd60004" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">金山区</div>
					</li>
					<li id="402881ef5668be4c015668be8e510001" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">青浦区</div>
						</a>
					</li>
					<li id="402881ef5668be4c015668bf9ca80006" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<a href="#">
							<div class="mui-media-body">奉贤区</div>
						</a>
					</li>
				</ul>

			</div>
			<div id="popover_zaiti" class="mui-popover mui-bar-popover" style="width: 100%;position:static;margin-top: 10%;">
				<ul id="table_view_zaiti" class="mui-table-view mui-grid-view mui-grid-9" style="width: 100%;">
					<li id="孵化器" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">孵化器</div>
					</li>
					<li id="众创空间" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">众创空间</div>
					</li>
					<li id="科技园" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3">
						<div class="mui-media-body">科技园</div>
					</li>
				</ul>

			</div>
			<div id="popover_zhineng" class="mui-popover mui-bar-popover" style="width: 100%;position:static;margin-top: 10%;">
				<ul id="table_view_zhineng" class="mui-table-view" style="width: 100%;">
					<li id="离我最近" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">离我最近</div>
					</li>
					<li id="评价最高" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">评价最高</div>
					</li>
					<li id="面积最大" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">面积最大</div>
					</li>
				</ul>

			</div>
			<div id="popover_shaixuan" class="mui-popover mui-bar-popover" style="width: 100%;position:static;margin-top: 10%;">
				<ul id="table_view_shaixuan" class="mui-table-view" style="width: 100%;">
					<li id="dzxx" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">电子信息</div>
					</li>
					<li id="hlwyydhlw" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">互联网与移动互联网</div>
					</li>
					<li id="kjfwy" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">科技服务业</div>
					</li>
					<li id="swyy" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">生物医药</div>
					</li>
					<li id="xcl" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">新材料</div>
					</li>
					<li id="xjzz" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">先进制造</div>
					</li>
					<li id="xnyjjnhb" class="mui-table-view-cell mui-media mui-col-xs-4 mui-col-sm-3" style="width: 100%;">
						<div class="mui-media-body">新能源及节能环保</div>
					</li>
				</ul>
			</div>
		</header>
		<span id="go_search" class="mui-icon mui-icon-search" style="position: fixed;font-size: 2em;left: 85%;z-index: 999;top: 3%;"></span>
		<div id="pullup-container" class="mui-content mui-scroll-wrapper" style="position: absolute;width: 100%;top:30%;padding-top: 0px;">
			<div class="mui-scroll">
				<ul id="listView" class="mui-table-view mui-table-view-chevron" style="margin-top: 0px;width: 100%;"></ul>
			</div>
		</div>
		<img id="show_map" src="../image/map.png" style="z-index: 999;top: 90%;margin-left: 5%;font-size: 200%;width: 20%;position: fixed;background-color: #F2F2F2;"></img>
	</body>
	<script src="../js/mui.min.js"></script>
	<script src="../js/mui.lazyload.js"></script>
	<script src="../js/mui.lazyload.img.js"></script>
	<script src="../js/initData.js"></script>
	<script src="../js/rem.js"></script>
	<script type="text/javascript">
		var gallery = mui('.mui-slider');
		gallery.slider({
			interval: 2000 //自动轮播周期，若为0则不自动播放，默认为0；
		});

		function getBannar() {
			plus.nativeUI.showWaiting("数据加载中。。");
			mui.ajax("http://upday.ecst.com.cn:81/cyzsh/api/ad/list.do", {
				data: {},
				type: 'get', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
					plus.nativeUI.closeWaiting();
					var jsonvalue = JSON.parse(data).value;
					console.log("getBannar" + JSON.stringify(jsonvalue));
					var imgs_bannar = [];
					for(var i = 0; i < jsonvalue.length; i++) {
						imgs_bannar.push("http://upday.ecst.com.cn:81/" + jsonvalue[i].images);
					}
					console.log("imgs=" + imgs_bannar.toString());

					var b_cell = [];
					var i_cell = [];
					for(var i = 0; i < imgs_bannar.length; i++) {
						if(i == 0) {
							i_cell.push('<div class="mui-indicator mui-active"></div>');
							b_cell.push('<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;"><a href="#" style="height: 100%;width: 100%;display: block;"><img src="' + imgs_bannar[imgs_bannar.length - 1] + '" style="height: 100%;width: 100%;"> \ </a></div>');
						} else {
							i_cell.push('<div class="mui-indicator"></div>')
						}
						b_cell.push('<div class="mui-slider-item" style="height: 100%;width: 100%;"><a href="#" style="height: 100%;width: 100%;"><img src="' + imgs_bannar[imgs_bannar.length - 1] + '" style="height: 100%;width: 100%;"></a></div>')
						if(i == (imgs_bannar.length - 1)) {
							b_cell.push('<div class="mui-slider-item mui-slider-item-duplicate" style="height: 100%;width: 100%;"><a href="#" style="height: 100%;width: 100%;"><img src="' + imgs_bannar[0] + '" style="height: 100%;width: 100%;"></a></div>')
						}
					};
					console.log(b_cell.toString());
					console.log(i_cell.toString());
					//document.getElementById("b_cell").innerHTML = b_cell.toString();
					//document.getElementById("i_cell").innerHTML = i_cell.toString();
					var slider = mui("#slider");
					slider.slider({
						interval: 5000
					});
				},
				error: function(xhr, type, errorThrown) {
					//异常处理；
					console.log(type);
					console.log(errorThrown);
					plus.nativeUI.closeWaiting();

				}
			});
		}

		var _ii = -1;
		var isOver = false;
		var page_num = 0;
		var is_a = "";
		var is_b = "";

		function addTags(tags) {
			var value = "";
			if(tags != null) {
				for(var i = 0; i < tags.split(",").length; i++) {
					var tag = '<p style="border:1px solid #CF2D28;display: inline;color: #CF2D28;font-size: 50%;">' + tagsToChinese(tags.split(",")[i]) + '</p>';
					value = value + tag;
				}
			} else {
				value = "&nbsp;";
			}

			return value;
		}

		function pullUpRefresh_get(num, a, b) {

			if(_ii != num || a != c || d != b) {
				list.innerHTML = "";
				body = [];
				page_num = 0;
				_ii = num;
				isOver = false;
				c = a;
				d = b;
			} else {
				page_num++
			}
			console.log("a=" + a + ",b=" + b);
			console.log("c=" + c + ",d=" + d);
			if(_ii == -1) {
				return
			}
			switch(num) {
				case 0:
					getCompanyBynear(page_num)
					break;
				case 1:
					getCompanyByDiqu(page_num, a, b)
					break;
					//					case 2:
					//						getCompanyByQ(page_num, a, b)
					//						break;
				case 3:
					getCompanyByZaiti(page_num, a, b)
					break;
				case 4:
					getCompanyByZhineng(page_num, a, b)
					break;
				case 5:
					getDataByMianJi(page_num, a, b)
					break;
				case 6:
					getCompanyByJuli(page_num, a, b)
					break;
			}

		}

		function getCompanyByJuli(page_num, city, zhineng) {
			console.log(zhineng)
			if(page_num == 0) {
				page_num = 1;
				self.page_num = 1;
			}
			plus.geolocation.getCurrentPosition(function(position) {
				console.log("经度：" + position.coords.longitude);
				console.log("纬度：" + position.coords.latitude);
				var locations = position.coords.longitude + "," + position.coords.latitude;
				loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/distance_list.do", {
					"lat": "" + position.coords.latitude,
					"lng": "" + position.coords.longitude,
					"page": "" + page_num
				})
			})

		}

		function getCompanyByZhineng(page_num, city, zhineng) {
			console.log(zhineng)
			loadData("http://api.map.baidu.com/geosearch/v3/local", {
				"ak": "IbRZThgkSbo11nTpx3Ue4Olvym059LpR",
				"geotable_id": "147704",
				"region": city,
				"sortby": zhineng,
				"page_index": page_num,
				"page_size": "50"
			})
			//
			//				plus.geolocation.getCurrentPosition(function(position) {
			//					console.log("经度：" + position.coords.longitude);
			//					console.log("纬度：" + position.coords.latitude);
			//					var locations = position.coords.longitude + "," + position.coords.latitude;
			//
			//				})

		}

		function getCompanyByZaiti(page_num, city, zaiti) {
			console.log("page_num=" + page_num + zaiti);
			loadData("http://api.map.baidu.com/geosearch/v3/local", {
				"ak": "IbRZThgkSbo11nTpx3Ue4Olvym059LpR",
				"geotable_id": "147704",
				"region": city,
				"page_size": "50",
				"page_index": page_num,
				"q": zaiti
			})
		}

		function getCompanyByDiqu(page_num, city, diqu) {
			console.log("page_num=" + page_num + diqu);
			loadData("http://api.map.baidu.com/geosearch/v3/local", {
				"ak": "IbRZThgkSbo11nTpx3Ue4Olvym059LpR",
				"geotable_id": "147704",
				"region": city + diqu,
				"sortby": "distance:1",
				"page_index": page_num,
				"page_size": "50"
			})
		}

		function getCompanyBynear(page_num) {
			plus.geolocation.getCurrentPosition(function(position) {
				console.log("经度：" + position.coords.longitude);
				console.log("纬度：" + position.coords.latitude);
				var locations = position.coords.longitude + "," + position.coords.latitude;
				loadData("http://api.map.baidu.com/geosearch/v3/nearby", {
					"ak": "N7BGXOMidkY22Ms8NrxF05PAGOonaFHu",
					"geotable_id": "147704",
					"location": locations,
					"radius": "5000",
					"page_index": page_num,
					"page_size": "50"
				})
			})
		}
		var list = document.getElementById("listView");

		var body = [];

		function loadData_BenDi(url, getdata) {
			console.log("@@@@url=" + url + ",data=" + JSON.stringify(getdata))
			plus.nativeUI.showWaiting("数据加载中。。");
			mui.ajax(url, {
				data: getdata,
				//					dataType: "text",
				type: 'get', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
					mui('#pullup-container').pullRefresh().endPullupToRefresh(isOver);
					plus.nativeUI.closeWaiting();
					console.log("公司1" + data)
					addDataItem(JSON.parse(data).value, 1);
				},
				error: function(xhr, type, errorThrown) {
					//异常处理；
					console.log(type);
					console.log(errorThrown);
					plus.nativeUI.closeWaiting();

				}
			});
		};

		function loadData(url, getdata) {
			console.log("url=" + url + ",data=" + JSON.stringify(getdata))
			plus.nativeUI.showWaiting("数据加载中。。");
			mui.ajax(url, {
				data: getdata,
				dataType: "json",
				type: 'get', //HTTP请求类型
				timeout: 10000, //超时时间设置为10秒；
				success: function(data) {
					mui('#pullup-container').pullRefresh().endPullupToRefresh(isOver);
					plus.nativeUI.closeWaiting();
					body = data.contents;
					addDataItem(body, 0);
					console.log("请求成功！")
					console.log("公司" + JSON.stringify(data));

				},
				error: function(xhr, type, errorThrown) {
					//异常处理；
					console.log(type);
					console.log(errorThrown);
					plus.nativeUI.closeWaiting();
				}
			});
		};

		function getDataByMianJi(page_num, type, order) {
			if(page_num == 0) {
				page_num = 1;
				self.page_num = 1;
			}
			switch(type) {
				case "order":
					loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/list.do", {
						"order": order,
						"page": "" + page_num
					})
					break;
				case "score":
					loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/list.do", {
						"score": order,
						"page": "" + page_num
					})
					break;
				case "county":
					loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/list.do", {
						"county": order,
						"page": "" + page_num
					})
					break;
				case "type":
					loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/list.do", {
						"type": order,
						"page": "" + page_num
					})
					break;
				case "tag":
					loadData_BenDi("http://upday.ecst.com.cn:81/cyzsh/api/supporter/list.do", {
						"tag": order,
						"page": "" + page_num
					})
					break;
			}
		}

		var city_name = "上海";
		mui.init({
			pullRefresh: {
				container: '#pullup-container',
				up: {
					contentrefresh: '正在加载...', //可选，正在加载状态时，上拉加载控件上显示的标题内容
					contentnomore: '没有更多数据了', //可选，请求完毕若没有更多数据时显示的提醒内容；
					callback: function() {
						console.log("开始加载");
						pullUpRefresh_get(_ii, is_a, is_b);
					} //必选，刷新函数，根据具体业务来编写，比如通过ajax从服务器获取新数据；
				}
			}
		});
		mui.plusReady(function() {
			getBannar();
			document.getElementById("show_map").addEventListener("tap", function() {
				plus.webview.open("map_list.html");
			});
			pullUpRefresh_get(0);
			document.getElementById("go_search").addEventListener("click", function() {
				console.log("232323")
				plus.webview.open("search_page.html");
			});

			mui("#table_view_diqu").on("tap", ".mui-table-view-cell", function() {
				var diqu_name = this.getAttribute("id");
				switch(diqu_name) {
					case "附近":
						pullUpRefresh_get(0);
						_ii = 0;
						mui(".mui-popover").popover("hide");
						return;
					case "全部":
						diqu_name = "";
						break;
					case "关闭选择":
						mui(".mui-popover").popover("hide");
						return;
				}
				is_a = "county";
				is_b = diqu_name;
				pullUpRefresh_get(5, "county", diqu_name);
				_ii = 5;
				mui(".mui-popover").popover("hide");
			});
			mui("#table_view_zaiti").on("tap", ".mui-table-view-cell", function() {
				var zaiti_name = this.getAttribute("id");
				switch(zaiti_name) {
					case "孵化器":
						zaiti_name = "incubator";
						break;
					case "众创空间":
						zaiti_name = "gis";
						break;
					case "科技园":
						zaiti_name = "tech_park";
						break;
				}
				is_a = "type";
				is_b = zaiti_name;
				pullUpRefresh_get(5, "type", zaiti_name);
				_ii = 5;
				mui(".mui-popover").popover("hide");
			});
			mui("#table_view_shaixuan").on("tap", ".mui-table-view-cell", function() {
				var zaiti_name = this.getAttribute("id");
				is_a = "tag";
				is_b = zaiti_name;
				pullUpRefresh_get(5, "tag", zaiti_name);
				_ii = 5;
				mui(".mui-popover").popover("hide");
			});
			mui("#table_view_zhineng").on("tap", ".mui-table-view-cell", function() {
				var zhineng_name = this.getAttribute("id");
				switch(zhineng_name) {
					case "离我最近":
						//							pullUpRefresh_get(0);
						//							_ii = 0;
						//							mui(".mui-popover").popover("hide");
						//							return;
						zhineng_name = "distance:1";
						_ii = 6;
						is_a = "上海";
						is_b = zhineng_name;
						pullUpRefresh_get(6, "上海", zhineng_name);
						break;
					case "评价最高":
						zhineng_name = "score";
						_ii = 5;
						is_a = "上海";
						is_b = zhineng_name;
						pullUpRefresh_get(5, "order", zhineng_name);
						break;
					case "面积最大":
						zhineng_name = "area";
						_ii = 5;
						is_a = "上海";
						is_b = zhineng_name;
						pullUpRefresh_get(5, "order", zhineng_name);
						break;
				}
				mui(".mui-popover").popover("hide");
			});
		});

		function addStar(num) {
			var _star = '<span class="mui-icon mui-icon-star-filled" style="font-size: 100%;"></span>';
			var _unstar = '<span class="mui-icon mui-icon-star" style="font-size: 100%;"></span>';
			var value = "";
			for(var i = 0; i < 5; i++) {
				if(i < num) {
					value = value + _star;
				} else {
					value = value + _unstar;
				}
			}
			console.log("addStar=" + value);
			return value;
		}

		function addDataItem(body, isbendi) {
			console.log("长度为:" + body.length);
			if(body.length == 50) {
				isOver = false
				console.log("继续获取数据");
			} else {
				isOver = true
				console.log("停止获取数据");
			}
			for(i = 0; i < body.length; i++) {
				var li = document.createElement("li");
				li.className = "mui-table-view-cell mui-media";
				if(isbendi == 0) {
					var company_descr = body[i].address;
					if(company_descr == null) {
						company_descr = "暂无简介";
					};
					var company_brand = body[i].brand;
					if(company_brand == null) {
						company_brand = "<br/>";
					};
					var company_title_image = "../image/loading.jpg";
					if(body[i].images != null) {
						var imageStr = body[i].images;
						if(imageStr.indexOf(",") == 0) {
							imageStr = imageStr.substring(1);
						}
						var imageArray = imageStr.split(",");
						if(imageArray.length > 0) {
							company_title_image = "http://upday.ecst.com.cn:81/" + imageArray[0];
						}
					}
					var company_name = body[i].company_name
					var company_id = body[i].company_id
					li.innerHTML = '<a style="height: 100%;"><img class="mui-pull-left" data-lazyload=' + company_title_image + ' style="width: 100px; height: 100px;padding-right: 2%;" /><div class="mui-media-large" style="width: 100%; height: 20%;"><p class="mui-ellipsis" style="color: #000000;">' + company_name + '</p><p class="mui-ellipsis" style="color: #000000;">' + company_brand + '</p>' + addStar(body[i].score) + addTags(body[i].tags) + '<br/><p class="mui-ellipsis-2" style="font-size: 80%;">' + company_descr + '</p></div></a>';
				} else {
					var company_descr = body[i].description;
					if(company_descr == null) {
						company_descr = "暂无简介";
					};
					var company_brand = body[i].brand;
					if(company_brand == null) {
						company_brand = "<br />";
					};
					var company_title_image = "../image/loading.jpg";
					if(body[i].images != null) {
						var imageStr = body[i].images;
						if(imageStr.indexOf(",") == 0) {
							imageStr = imageStr.substring(1);
						}
						var imageArray = imageStr.split(",");

						if(imageArray.length > 0) {
							company_title_image = "http://upday.ecst.com.cn:81/" + imageArray[0];
						}
					}
					var company_name = body[i].name
					var company_id = body[i].id
					li.innerHTML = '<a style="height: 100%;"><img class="mui-pull-left" data-lazyload=' + company_title_image + ' style="width: 100px; height: 100px;padding-right: 2%;" /><div class="mui-media-large" style="width: 100%; height: 20%;"><p class="mui-ellipsis" style="color: #000000;">' + company_name + '</p><p class="mui-ellipsis" style="color: #000000;">' + company_brand + '</p>' + addStar(body[i].score) + '<br/>' + addTags(body[i].tags) + '<br/><p class="mui-ellipsis-2" style="font-size: 80%;">' + company_descr + '</p></div></a>';
				}
				li.setAttribute("com_id", company_id);

				//					li.setAttribute("com_area", body[i].company_area);
				//					li.setAttribute("com_num", body[i].companyNum);
				//					li.setAttribute("com_phone", body[i].phone);
				//					li.setAttribute("com_name", body[i].company_name);
				//					li.setAttribute("com_address", body[i].address);
				//					li.setAttribute("com_type", body[i].company_type);
				//					li.setAttribute("com_location_jingdu", body[i].location[0])
				//					li.setAttribute("com_location_weidu", body[i].location[1])
				//					li.setAttribute("com_images", body[i].images)
				//					li.setAttribute("com_score", body[i].score)
				//					li.setAttribute("com_level", body[i].level)
				//					li.setAttribute("com_tags", body[i].tags_)
				li.addEventListener("tap", function() {
					//						var com_area = this.getAttribute("com_area");
					//						var com_num = this.getAttribute("com_num");
					//						var com_phone = this.getAttribute("com_phone");
					//						var com_name = this.getAttribute("com_name");
					//						var com_address = this.getAttribute("com_address");
					//						var com_type = this.getAttribute("com_type");
					//						var com_location_jingdu = this.getAttribute("com_location_jingdu");
					//						var com_location_weidu = this.getAttribute("com_location_weidu")
					//						var com_descr = this.getAttribute("com_descr")
					//						var com_score = this.getAttribute("com_score")
					//						var com_level = this.getAttribute("com_level")
					//						var com_images = this.getAttribute("com_images")
					var com_id = this.getAttribute("com_id")
					//						var com_tags = this.getAttribute("com_tags")
					console.log("idididi=" + com_id);
					plus.nativeUI.showWaiting("数据加载中。。");
					plus.webview.create("search_show.html", "", "", {
						//							company_area: com_area,
						//							companyNum: com_num,
						//							phone: com_phone,
						//							company_name: com_name,
						//							company_type: com_type,
						//							address: com_address,
						//							location_jingdu: com_location_jingdu,
						//							location_weidu: com_location_weidu,
						//							company_descr: com_descr,
						//							score: com_score,
						//							level: com_level,
						//							images: com_images,
						company_id: com_id,
						//							company_tags: com_tags,
					});
				});
				list.appendChild(li);
			};
			mui(".mui-table-view-cell").imageLazyload({
				placeholder: '../image/loading.jpg'
			});
			console.log("停止：" + isOver);
		}
		if(mui.os.plus) {
			mui.plusReady(function() {
				setTimeout(function() {
					mui('#pullup-container').pullRefresh().pullupLoading();
				}, 1000);

			});
		} else {
			mui.ready(function() {
				mui('#pullup-container').pullRefresh().pullupLoading();
			});
		}
	</script>
</html>